package _9995ChuanShuDuiXiang;

import java.util.ArrayList;
import java.util.List;

/**
 * @StudentBo: 业务对象
 * @author: ZBoHang
 * @time: 2021/9/18 13:26
 */
public class StudentBo {
    List<StudentVo> studentVos;

    public StudentBo() {
        studentVos = new ArrayList<>();
        StudentVo s1 = new StudentVo("二狗", 0);
        StudentVo s2 = new StudentVo("大傻", 1);
        studentVos.add(s1);
        studentVos.add(s2);
    }

    public void deleteStudent(StudentVo studentVo) {
        studentVos.remove(studentVo.getRollNo());
        System.out.println("移除了 --> " + studentVo.getName());
    }

    public List<StudentVo> getStudentVos() {
        return studentVos;
    }

    public StudentVo getStudent(int rollNo) {
        return studentVos.get(rollNo);
    }

    public void updateStudent(StudentVo studentVo) {
        studentVos.get(studentVo.getRollNo()).setName(studentVo.getName());
        System.out.println("修改 --> " + studentVo);
    }
}
